package com.star.uc.infras.properties;

import com.star.uc.contract.enums.iplimit.IpLimitTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * ip限制类型
 *
 * @author zhouhengzhe
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "star.limit")
public class LimitProperties {

    /**
     * ip白名单相关的配置
     */
    private IpConfig ip;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class IpConfig {
        /**
         * ip限制类型
         *
         * @see com.star.uc.contract.enums.iplimit.IpLimitTypeEnum
         */
        private String type = IpLimitTypeEnum.DEFAULT.getCode();

        /**
         * type为GEETEST时必填
         */
        private GeetestProperties geetest;


        /**
         * 极客校验的配置
         */
        @Data
        @AllArgsConstructor
        @NoArgsConstructor
        public static class GeetestProperties {
            /**
             * 极验的ID
             */
            private String geetestId;

            /**
             * 极验的key
             */
            private String geetestKey;
        }
    }
}
